package com.aerozhonghuan.logisticsmall.framework.hybrid.actions;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.aerozhonghuan.logisticsmall.BuildConfig;
import com.aerozhonghuan.logisticsmall.framework.hybrid.NewWebviewFragment;
import com.aerozhonghuan.logisticsmall.framework.hybrid.SimpleActionHandler;
import com.aerozhonghuan.logisticsmall.framework.hybrid.bean.JsMobileAgentConstants;
import com.aerozhonghuan.hybrid.XJsCallback;

import org.json.JSONObject;

import java.util.HashMap;
import java.util.Map;

/**
 * 描述 获取业务基地址
 * 作者 Zhang Yonghui
 * 创建日期 2019/1/21
 */
public class GetHostActionHandler extends SimpleActionHandler {
    private static final String KEY_URLHOST = "urlHost";

    public GetHostActionHandler(NewWebviewFragment fragment) {
        super(JsMobileAgentConstants.FLAG_GETHOST, fragment);
    }

    @Override
    public void handleAction(@NonNull String action, @Nullable JSONObject params, @Nullable XJsCallback callBack) {
        Map<String, String> resultParams = new HashMap<>();
        resultParams.put(KEY_URLHOST, BuildConfig.HOST_BUSINESS);
        onResult(resultParams, callBack);
    }
}
